<?php

class company_contacts extends CActiveRecord
{
	/**
	 * The followings are the available columns in table 'contact_info':
	 * @var integer $id
	 * @var integer $contact_id
	 * @var integer $type
	 * @var string $ref
	 */
        public $teleType = array(0=>'General',1=>'Sale',2=>'Accounts',3=>'Exports',4=>'Import',5=>'Enquiry');
        public $faxType = array(10=>'General',11=>'Sale',12=>'Accounts',13=>'Exports',14=>'Import',15=>'Enquiry');
        public $emailType = array(20=>'General',21=>'Sale',22=>'Accounts',23=>'Exports',24=>'Import',25=>'Enquiry');
	/**
	 * Returns the static model of the specified AR class.
	 * @return CActiveRecord the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'company_contacts';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('type', 'required'),
			array('type, ref', 'numerical', 'integerOnly'=>true),
			array('ref', 'length', 'max'=>254),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
                    'company'=>array(self::BELONGS_TO,'company','id'),
		);
	}
	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'Id',
			'contact_id' => 'Contact',
			'type' => 'Type',
			'ref' => 'Number.',
		);
	}
}